fix(devtools-kit): treat string value 'undefined' as a string, not null - #2
Closed
arena-ai-coding-agent[bot] wants to merge 1 commit into
Closed
fix(devtools-kit): treat string value 'undefined' as a string, not null#2arena-ai-coding-agent[bot] wants to merge 1 commit into
arena-ai-coding-agent[bot] wants to merge 1 commit into
Conversation
When a state value (e.g. a Pinia store state) contains the string 'undefined', getInspectorStateValueType wrongly classified it as the null/undefined type because of a literal string check. This caused the value to be rendered as the actual undefined value instead of a string. Remove the erroneous check for the literal 'undefined' string. Real undefined values are represented by the UNDEFINED sentinel token, so they are still handled correctly. Closes vuejs#1087
Author
|
Closing this PR because issue vuejs#1087 is already addressed by the existing upstream PR vuejs#1088. This change would be a duplicate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a state value (e.g. a Pinia store
statefield) contains the string"undefined", Vue DevTools renders it as the actualundefinedvalue instead of a string:Cause
getInspectorStateValueType()inpackages/devtools-kit/src/core/component/state/format.tscontained a literal string check:A real
undefinedvalue is represented internally by theUNDEFINEDsentinel token (__vue_devtool_undefined__), so thevalue === 'undefined'branch was unnecessary and wrongly flagged the legitimate string'undefined'as the null/undefined type. The UI then styles it with thenull-state-typeclass (no quotes, null styling), making it look like the realundefined.Fix
Remove the erroneous
value === 'undefined'check. Actualundefinedvalues are still correctly handled byvalue == nullandvalue === UNDEFINED.Tests
Added a regression test that asserts the string
'undefined'is classified asstringand renders as'undefined'. The full suite passes (86 tests) along withtype-check,lint, andbuild.Closes vuejs#1087